<?php

namespace App\Kuafu\Shop\Controller\B;

use App\Kuafu\Base\Controller\BaseController;
use App\Kuafu\Shop\Service\AreaService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class AreaController extends BaseController
{

    /**
     * @param Request $request
     * @return JsonResponse
     */
    public function areaLists(Request $request): JsonResponse
    {
        $areaId = (int) $request->get('areaId', 0);
        return $this->success(AreaService::getAreaLists($areaId));
    }


    /**
     * @param Request $request
     * @return JsonResponse
     */
    public function getCityGrade(Request $request): JsonResponse
    {
        $cityCode = $request->get("cityCode", "");
        return $this->success(AreaService::getCityGrade($cityCode));
    }

    public function areaListAll(Request $request)
    {
        return $this->success(AreaService::getListAll());
    }

}
